﻿@using PagedList;
@using PagedList.Mvc;

@model IPagedList<EventSys.BussinesEntities.Evento>


@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
    <link href="@Url.Content("~/Content/PagedList.css")" rel="stylesheet" type="text/css" />
}

@section scripts{

    <script type="text/javascript">

        /*$(function () {
            $('#tablaEvento tr>*').click(function (e) {
                //var a = $(this).closest('tr').find('a')
                var id = $(this).closest('tr').find('a').text();
                //e.preventDefault();
                alert(id);
                //$(this).select("tr").css("background-color", "#ECF8E0");
                //location.href = a.attr('href')
            })
        })*/

    </script>
}

@*@using (Html.BeginForm())
{
    <fieldset>
        <legend><b>Criterio:</b> </legend>
        <input type="search" name="criterio" value="" placeholder="Ingrese Nombre de Evento"/>
        <input type="submit" name="buscar" value="Buscar" class="k-button"/>
    </fieldset>
}*@

<h2>Index</h2>
    <p>@Html.ActionLink("Crear Nuevo Evento", "Create")</p>

<div class="CSSTableGenerator">

<table style="width:1250px" id="tablaEvento">
    <tr style="height:20px; ">
        <th></th>
        <th style="width:102px; "></th>
        <th style="width:20px; display:table-column">  id </th>
        <th style="width:400px; ">  Nombre del Evento </th>
        <th style="width:60px; ">  Inicia </th>
        <th style="width:60px; ">  Finaliza </th>
        <th style="width:200px; ">  Tipo Evento </th>
        <th style="width:300px; ">  Carrera </th>
        <th style="width:150px; ">  Sede </th>
        <th style="width:200px; ">  Ing. Libre </th>
        <th style="width:220px; ">  Estado </th>
        <th style="width:100px; ">  Simple </th>
        <th style="width:300px; "> </th>
    </tr>

@foreach (var item in Model) {
    <tr style="height:7px">
        <td>
            @Ajax.ActionLink("Actividades", "viewActividads","Evento", new { id = item.idEvents }, new AjaxOptions { UpdateTargetId="divActividads" })
        </td>
        <td>
            @Html.ActionLink("+ Actividad", "CreateAct", new {  id=item.idEvents}) 
        </td>
        <td style="display:table-column" id="ID"><a >@Html.DisplayFor(modelItem => item.idEvents)</a></td>
        <td>
            @Html.DisplayFor(modelItem => item.NomEvento)
        </td>
        <td>
            @*@Html.DisplayFor(modelItem => item.FechaIni)*@
            @String.Format("{0:d}", item.FechaIni)
        </td>
        <td>
            @String.Format("{0:d}", item.FechaFin)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.TipoActividad.Descripcion)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Carrera)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Sede)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.IngresoLibre)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Estado.Estado1)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.EventoSimple)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new {  id=item.idEvents,nombre=item.NomEvento}) |
            @*@Html.ActionLink("Details", "Details", new { id=item.idEvents })*@ @*|
            @Html.ActionLink("Delete", "Delete", new {id=item.idEvents})*@
        </td>
    </tr>
}
@*<div id="divActividads"> </div>*@
</table>
 </div>

<div>
    @Html.PagedListPager(Model, page => Url.Action("Index", new { page })) 
</div>

<div id="divActividads" class="CSSTableGenerator"> </div>